<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/extjs/include/all.jsp"%>


<html>
 <head>
  <title>根菜单列表</title>
 </head>

 <body>
   <script>
   Ext.onReady(function(){
   
   	var menuListStore = new Ext.data.JsonStore({
		url: '${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl::/extMenuModule/action/GetRootMenuList.action',
		root: 'rootMenuList',
		fields: [
			{name:'id'},
			{name:'label'},
			{name:'symbolicName'},
			{name:'path'}
		]
	});   
	menuListStore.load();
	
	var resultWidth = Ext.get("showRootMenu").getWidth();
	var cm = new Ext.grid.ColumnModel([ 
	    new Ext.grid.RowNumberer(), 
        {header:'菜单名称',dataIndex:'label',width:resultWidth*0.25,renderer:function(value, p, record){
        	return String.format("<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl/extMenuModule/page/childMenuItemList.jsp?id={1}&symbolicName={2}\">{0}</a>", 
	        		value,record.data.id,record.data.symbolicName
       	);
        }}, 
        {header:'bundle名称',dataIndex:'symbolicName',width:resultWidth*0.25}, 
        {header:'菜单路径',dataIndex:'path',width:resultWidth*0.25},
        {header:'操作',dataIndex:'',width:resultWidth*0.25,renderer:function(value, p, record){
        	return String.format("<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl::/menuModule/action/MenuItemUptoFirst.action?id={0}&symbolicName={1}&&menuType=root\">最上</a>&nbsp;&nbsp;"+
        	"<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl::/menuModule/action/MenuItemUp.action?id={0}&symbolicName={1}&&menuType=root\">上移</a>&nbsp;&nbsp;"+
	        "<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl::/menuModule/action/MenuItemDown.action?id={0}&symbolicName={1}&&menuType=root\">下移</a>&nbsp;&nbsp;"+
	        "<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.menu.impl::/menuModule/action/MenuItemDowntoLast.action?id={0}&symbolicName={1}&&menuType=root\">最下</a>",		
	        		record.data.id,record.data.symbolicName);}
        }
    ]); 
    cm.defaultSortable = false; 
       
	var grid = new Ext.grid.GridPanel({ 
	    el:'showRootMenu', 
	    title:'根菜单列表', 
	   // height:550, 
	   autoHeight:true,
	    collapsible:true,
	    stripeRows: true,
	    collapsible:true,
	    bodyStyle:'width:100%',
	    trackMouseOver:false, 
	    loadMask: {msg:'正在加载数据，请稍侯……'}, 
	    store:menuListStore, 
	    cm: cm
	}); 
    grid.render(); 	
});
   </script>

  <div id="showRootMenu" style="width:100%"></div>
 </body>
 </html>
